@model FruitCake.ContactPage.Models.ContactPagePart
@using FruitCake.SupportLibrary.Extensions

@{
    var addClass = new { @class = "large text", @maxlength = "500" };
    var inputClass = new { @class = "large text" };
}

<fieldset>
    <legend></legend>
    @Html.LabelFor(m => m.MailCaption, T("Caption for Mail field"))
    @Html.TextBoxFor(m => m.MailCaption, inputClass)
</fieldset>
<fieldset>
    <legend></legend>
    @Html.LabelFor(m => m.TextCaption, T("Caption for text field"))
    @Html.TextBoxFor(m => m.TextCaption, inputClass)
</fieldset>
<fieldset>
    <legend></legend>
    <span class="checkbox-and-label">
    @Html.EditorFor(m => m.IsNameVisible)
    @Html.LabelFor(m => m.IsNameVisible, T("Show name field"), "forcheckbox")
    </span>
    <div data-controllerid="@Html.FieldIdFor(m => m.IsNameVisible)" style="margin-left: 20px;">
        @Html.LabelFor(m => m.NameCaption, T("Caption for Name field"))             
        @Html.TextBoxFor(m => m.NameCaption, inputClass)             
    </div>
</fieldset>
<fieldset>
    <legend></legend>
    <span class="checkbox-and-label">
        @Html.EditorFor(m => m.IsReasonVisible)
        @Html.LabelFor(m => m.IsReasonVisible, T("Show reason field"), "forcheckbox")
    </span>
    <div data-controllerid="@Html.FieldIdFor(m => m.IsReasonVisible)" style="margin-left: 20px;">
        @Html.LabelFor(m => m.ReasonCaption, T("Caption for Reason field"))             
        @Html.TextBoxFor(m => m.ReasonCaption, inputClass)             
        @Html.LabelFor(m => m.ReasonsList, T("List of reasons"))
        @Html.TextAreaFor(m => m.ReasonsList, 10, 0, null)
        <span class="hint">@T("One rule for line: text|ToList|CcList|BccList. Use \';\' as separator in the addressees list. If you leave the list empty the default list is used.")</span>
    </div>
</fieldset>
<fieldset>
    <legend></legend>
    <span class="checkbox-and-label">
        @Html.EditorFor(m => m.IsSubjectVisible)
        @Html.LabelFor(m => m.IsSubjectVisible, T("Show subject field"), "forcheckbox")
    </span>
    <div data-controllerid="@Html.FieldIdFor(m => m.IsSubjectVisible)" style="margin-left: 20px;">
        @Html.LabelFor(m => m.SubjectCaption, T("Caption for Subject field"))
        @Html.TextBoxFor(m => m.SubjectCaption, inputClass)
        @Html.EditorFor(m => m.SubjectIsRequired)
        @Html.LabelFor(m => m.SubjectIsRequired, T("Subject is required"), "forcheckbox")
    </div>
</fieldset>
<fieldset>
    <legend></legend>
    <span class="checkbox-and-label">
        @Html.EditorFor(m => m.MailEnabled)
        @Html.LabelFor(m => m.MailEnabled, T("Enable send mail"), "forcheckbox")
    </span>
</fieldset>
<div data-controllerid="@Html.FieldIdFor(m => m.MailEnabled)" style="margin-left: 20px;">
    <fieldset>
        <legend></legend>
        @Html.LabelFor(m => m.ToList, T("ToList"))
        @Html.TextBoxFor(m => m.ToList, addClass)
        @Html.LabelFor(m => m.CcList, T("CcList"))
        @Html.TextBoxFor(m => m.CcList, addClass)
        @Html.LabelFor(m => m.BccList, T("BccList"))
        @Html.TextBoxFor(m => m.BccList, addClass)
        <span class="hint">@T("A list of mail addresses separated by ';'.")</span>
    </fieldset>
    <fieldset>
        <legend></legend>
        @Html.LabelFor(m => m.SubjectTemplate, T("Subject template"))
        @Html.TextBoxFor(m => m.SubjectTemplate, inputClass)    
        @Html.LabelFor(m => m.BodyTemplate, T("Body template"))
        @Html.TextAreaFor(m => m.BodyTemplate, new { @rows="16" })
        <span class="hint">@T("Inline paramaters for subject and body: {RequestId}, {RequestCode}, {Title}, {Host}, {Name}, {Mail}, {Reason}, {Text}, {ToList}, {CcList}, {BccList}, {SiteName}, {SiteUrl}, {UserId}, {UserName}, {UserMail}, {RequestDateTime}, {RequestDateTimeUTC}")</span>    
    </fieldset>
</div>
<fieldset>
    <legend></legend>
    <span class="checkbox-and-label">
        @Html.EditorFor(m => m.IsAfterSentOptionsVisible)
        @Html.LabelFor(m => m.IsAfterSentOptionsVisible, T("After sent options"), "forcheckbox")
    </span>
</fieldset>
<div data-controllerid="@Html.FieldIdFor(m => m.IsAfterSentOptionsVisible)" style="margin-left: 20px;">
    <fieldset>
        <legend></legend>
        @Html.LabelFor(m => m.RedirectTo, T("After send redirect to"))
        @Html.TextBoxFor(m => m.RedirectTo, inputClass)
        <span class="hint">@T("If empty UrlReferrer is used")</span>
    </fieldset>
    <fieldset>
        @Html.LabelFor(m => m.SentMessage, T("Success message after submitting the request"))
        @Html.TextAreaFor(m => m.SentMessage)    
    </fieldset>
</div>
<fieldset>
    <legend></legend>
    <span class="checkbox-and-label">
    @Html.CheckBox("ShowOptions")
    <label class="forcheckbox" for="ShowOptions">@T("Options")</label>
    </span>
</fieldset>
<div data-controllerid="ShowOptions" style="margin-left: 20px;">
    <fieldset>
        <legend></legend>
        @Html.LabelFor(m => m.TextMaxLength, T("Max lenght of text"))
        @Html.TextBoxFor(m => m.TextMaxLength)
    </fieldset>
    <fieldset>
        <legend></legend>
        @Html.LabelFor(m => m.TextClass, T("Text class"))
        @Html.TextBoxFor(m => m.TextClass)
        @Html.LabelFor(m => m.TextRows, T("Text rows"))
        @Html.TextBoxFor(m => m.TextRows)
        @Html.LabelFor(m => m.TextCols, T("Text columns"))
        @Html.TextBoxFor(m => m.TextCols)
    </fieldset>
    <fieldset>
        <legend></legend>
        @Html.LabelFor(m => m.InputClass, T("Input class"))
        @Html.TextBoxFor(m => m.InputClass)
        @Html.LabelFor(m => m.InputSize, T("Input size"))
        @Html.TextBoxFor(m => m.InputSize)
    </fieldset>
</div>